<?php class Eventlog { 

    /***
     * DB Fields: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $id;

    /***
     * DB Fields: eventTime
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $eventTime;

    /***
     * DB Fields: log
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $log;

    /***
     * DB Fields: summary
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $summary;

    /***
     * DB Fields: read
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $read;

    /***
     * DB Fields: userId
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $userId;

//--------------- GET METHODS ----------------------------- //
    /***
     * Get value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result id
     **/
    function get_id( ) {
        // returns the value of id
        return $this->id;
    }


    /***
     * Get value for field: eventTime
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result eventTime
     **/
    function get_eventTime( ) {
        // returns the value of eventTime
        return $this->eventTime;
    }


    /***
     * Get value for field: log
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result log
     **/
    function get_log( ) {
        // returns the value of log
        return $this->log;
    }


    /***
     * Get value for field: summary
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result summary
     **/
    function get_summary( ) {
        // returns the value of summary
        return $this->summary;
    }


    /***
     * Get value for field: read
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result read
     **/
    function get_read( ) {
        // returns the value of read
        return $this->read;
    }


    /***
     * Get value for field: userId
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result userId
     **/
    function get_userId( ) {
        // returns the value of userId
        return $this->userId;
    }


//--------------- SET METHODS ----------------------------- //
    /***
     * Set value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function set_id( $id ) {
        // sets the value of id
        $this->id = $id;
    }

    /***
     * Set value for field: eventTime
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param eventTime
     * @result void
     **/
    function set_eventTime( $eventTime ) {
        // sets the value of eventTime
        $this->eventTime = $eventTime;
    }

    /***
     * Set value for field: log
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param log
     * @result void
     **/
    function set_log( $log ) {
        // sets the value of log
        $this->log = $log;
    }

    /***
     * Set value for field: summary
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param summary
     * @result void
     **/
    function set_summary( $summary ) {
        // sets the value of summary
        $this->summary = $summary;
    }

    /***
     * Set value for field: read
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param read
     * @result void
     **/
    function set_read( $read ) {
        // sets the value of read
        $this->read = $read;
    }

    /***
     * Set value for field: userId
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param userId
     * @result void
     **/
    function set_userId( $userId ) {
        // sets the value of userId
        $this->userId = $userId;
    }

//--------------- CRUD METHODS ----------------------------- //
    /***
     * Create a new Record: eventlog
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param eventTime
     * @param log
     * @param summary
     * @param read
     * @param userId
     * @result void
     **/
    function createnew_eventlog( $id, $eventTime, $log, $summary, $read, $userId ) {

        // items to be inserted in the database 
        $_obj = array($id,
                      $eventTime,
                      $log,
                      $summary,
                      $read,
                      $userId); 

        // database object connection
        $dbConn = $GLOBALS['dbConn'];

        // perform insert in the database
        $dbConn->insert("eventlog", $_obj);
    }

    /***
     * Retrived an existing record: eventlog
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result new Eventlog
     **/
    function get_eventlog( $id ) {

        // retrive the data
        $dbConn = $GLOBALS['dbConn'];

        // retrieved value in the database
        $_resultSet = $dbConn->doQuery("SELECT * FROM eventlog WHERE id = '$id'");

        $__eventlogObj = new eventlog();
        // return the retrived from the database

        // create a new object
        $__obj = new Eventlog();
        $__obj->set_id($_resultSet[0]['id']);
        $__obj->set_eventTime($_resultSet[0]['eventTime']);
        $__obj->set_log($_resultSet[0]['log']);
        $__obj->set_summary($_resultSet[0]['summary']);
        $__obj->set_read($_resultSet[0]['read']);
        $__obj->set_userId($_resultSet[0]['userId']);


        return $__obj;
    }

    /***
     * Update an existing record: eventlog
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param itemsToBeUpdated = array()
     * @result void
     **/
    function update_eventlog( $id, $itemsToBeUpdated = array() ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs update in the database
         foreach($itemsToBeUpdated as $_fName => $_fVal) { 
               $dbConn->addValuePair($_fName, $_fVal);
         }

         // perform update operation
         $dbConn->update("eventlog", "id = '$id'");
    }

    /***
     * Delete an existing record: eventlog
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function delete_eventlog( $id ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs deletion of data
         $dbConn->delete("eventlog", "id = '$id'");
    }

    /***
     * Retrived list of objects base on a given parameters: eventlog
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param conditionalStatement = ''
     * @result collection of objects: Eventlog
     **/
    function list_eventlog( $conditionalStatement = '' ) {

         $dbConn = $GLOBALS['dbConn'];
         // check if there is a given parameter list
         if(!empty($conditionalStatement)) { 
              $sqlStatement = "SELECT * FROM eventlog WHERE $conditionalStatement"; 
         } else { 
              $sqlStatement = "SELECT * FROM eventlog";
         }

         // retrieve the values base on the query result
         $__resObj = $dbConn->doQuery($sqlStatement);

         $__collectionOfObjects = array();
         foreach($__resObj as $__rs) { 
            $__newObj = new Eventlog();

            $__newObj->set_id($__rs['id']);
            $__newObj->set_eventTime($__rs['eventTime']);
            $__newObj->set_log($__rs['log']);
            $__newObj->set_summary($__rs['summary']);
            $__newObj->set_read($__rs['read']);
            $__newObj->set_userId($__rs['userId']);

            // add object to collection 
            array_push($__collectionOfObjects, $__newObj);
         }

         // return collection of objects
         return $__collectionOfObjects;
    }

} ?>